#include<stdio.h>
#include<string.h>

void insert_char(char s[],int position,char a)
{
	char string[100];
	if(!strlen(s))		//s数组为空直接复制a字符到s中
	{
		string[0]=a;
	}
	else
	{
		strncpy(string,s,position);//将s数组中前position个字符复制到数组string中
		string[position]=a;
		string[position+1]='\0';
		//strcat(string,t);
		strcat(string,(s+position));
		strcpy(s,string);
	}
	
}
int main()
{
	char str1[100],a;
	int len;
	printf("Please input str1:\n");
	gets(str1);
	printf("Please input a char:\n");
	scanf("%c",&a);
	printf("Please input position:\n");
	scanf("%d",&len);
	insert_char(str1,len,a);
	puts(str1);
	return 0;
}
